home *** CD-ROM | disk | FTP | other *** search
/ Champak 50 / Volume 50 - JOGO DISK .iso / Games / moonstonemadness.swf / scripts / __Packages / NickHS.as < prev    next >
Encoding:
Text File  |  2007-09-27  |  3.9 KB  |  153 lines

  1. class NickHS
  2. {
  3.    var bHSAvailable;
  4.    var G_TestHighScore;
  5.    var bSubmitHS;
  6.    var bGetHS;
  7.    var G_GameID;
  8.    var mcHSZone;
  9.    var G_NoTxtField;
  10.    var G_NameTxtField;
  11.    var G_ScoreTxtField;
  12.    static var oNickHS;
  13.    function NickHS()
  14.    {
  15.       this.bHSAvailable = true;
  16.       this.G_TestHighScore = false;
  17.       this.bSubmitHS = false;
  18.       this.bGetHS = false;
  19.       this.G_GameID = "tak_stone";
  20.       this.mcHSZone = undefined;
  21.       this.initHiScores();
  22.       if(this.G_TestHighScore == true)
  23.       {
  24.          _global.gProxyObj.setServer("www.nick.com");
  25.          _global.gProxyObj.setScreenName("sbkRR2.0");
  26.          _global.gProxyObj.setIsLoggedIn(true);
  27.       }
  28.       NickHS.oNickHS = this;
  29.    }
  30.    function doHSInit()
  31.    {
  32.       this.initHiScores();
  33.    }
  34.    function doSubmitHS()
  35.    {
  36.       this.bSubmitHS = true;
  37.    }
  38.    function doViewHS()
  39.    {
  40.       this.bGetHS = true;
  41.    }
  42.    function setHSBoard(_mcRef)
  43.    {
  44.       this.mcHSZone = _mcRef;
  45.       this.G_NoTxtField = this.mcHSZone.txtHSNumber;
  46.       this.G_NameTxtField = this.mcHSZone.txtHSName;
  47.       this.G_ScoreTxtField = this.mcHSZone.txtHSScore;
  48.    }
  49.    static function get Instance()
  50.    {
  51.       return NickHS.oNickHS;
  52.    }
  53.    function getIsLoggedIn()
  54.    {
  55.       var _loc2_ = false;
  56.       if(_global.gProxyObj != undefined)
  57.       {
  58.          _loc2_ = _global.gProxyObj.getIsLoggedIn();
  59.       }
  60.       return _loc2_;
  61.    }
  62.    function getScores()
  63.    {
  64.       if(_global.gProxyObj == undefined)
  65.       {
  66.          this.listScores();
  67.       }
  68.       else
  69.       {
  70.          _global.gProxyObj.getScores(this.cbFunc2);
  71.       }
  72.    }
  73.    function submitScore(theScore)
  74.    {
  75.       this.G_NoTxtField.text = "";
  76.       this.G_NameTxtField.text = "The high score list is updating!";
  77.       this.G_ScoreTxtField.text = "";
  78.       _global.gProxyObj.submitScore(theScore,this.cbFunc);
  79.    }
  80.    function initHiScores()
  81.    {
  82.       _global.gProxyObj.setGame_Id(this.G_GameID);
  83.    }
  84.    function getScoreString()
  85.    {
  86.       var _loc11_ = "Oops! The high score list is not available right now!";
  87.       if(_global.gProxyObj != undefined)
  88.       {
  89.          var _loc7_ = _global.gProxyObj.getScoreCount();
  90.          if(_loc7_ > 0)
  91.          {
  92.             var _loc3_ = undefined;
  93.             var _loc4_ = undefined;
  94.             var _loc5_ = undefined;
  95.             var _loc6_ = undefined;
  96.             _loc11_ = "";
  97.             var _loc10_ = "";
  98.             var _loc9_ = "";
  99.             var _loc8_ = "";
  100.             _loc3_ = 0;
  101.             while(_loc3_ < _loc7_)
  102.             {
  103.                _loc4_ = _global.gProxyObj.getScoreItem(_loc3_);
  104.                _loc5_ = _loc4_[0];
  105.                _loc6_ = Library.Utils.Tools.returnFormatedNumber(_loc4_[1]);
  106.                _loc10_ += _loc3_ + 1 + "\n";
  107.                _loc9_ += _loc5_ + "\n";
  108.                _loc8_ += _loc6_ + " pts" + "\n";
  109.                _loc3_ = _loc3_ + 1;
  110.             }
  111.             this.G_NoTxtField.text = _loc10_;
  112.             this.G_NameTxtField.text = _loc9_;
  113.             this.G_ScoreTxtField.text = _loc8_;
  114.          }
  115.          else
  116.          {
  117.             this.G_NameTxtField.text = "Oops! The high score list is not available right now!";
  118.          }
  119.       }
  120.       else
  121.       {
  122.          this.G_NameTxtField.text = "Oops! The high score list is not available right now!";
  123.       }
  124.       return _loc11_;
  125.    }
  126.    function listScores()
  127.    {
  128.       this.getScoreString();
  129.    }
  130.    function cbFunc(thisBool)
  131.    {
  132.       if(thisBool)
  133.       {
  134.          NickHS.Instance.listScores();
  135.       }
  136.       else
  137.       {
  138.          NickHS.Instance.G_NameTxtField.text = "Oops! The high score list is not available right now!";
  139.       }
  140.    }
  141.    function cbFunc2(thisBool)
  142.    {
  143.       if(thisBool)
  144.       {
  145.          NickHS.Instance.listScores();
  146.       }
  147.       else
  148.       {
  149.          NickHS.Instance.G_NameTxtField.text = "Oops! The high score list is not available right now!";
  150.       }
  151.    }
  152. }
  153.